be54b9f38e348a8fd834c2fcca9f3a6f57beedc3,src/main/java/com/solab/iso8583/parse/LlbinParseInfo.java,LlbinParseInfo,parseBinary,#number#number[]#number#CustomField#,79
Before Change
throw new ParseException(String.format("Invalid bin LLBIN length %d pos %d", length, pos), pos);
}
if (length+pos+1 > buf.length) {
throw new ParseException(String.format(
"Insufficient data for bin LLBIN field %d, pos %d", field, pos), pos);
}
byte[] _v = new byte[length];
System.arraycopy(buf, pos+1, _v, 0, length);
After Change
throw new ParseException(String.format("Invalid bin LLBIN length %d pos %d", length, pos), pos);
}
if (l+pos+1 > buf.length) {
throw new ParseException(String.format(
"Insufficient data for bin LLBIN field %d, pos %d: need %d, only %d available",
field, pos, l, buf.length), pos);
}
byte[] _v = new byte[l];
System.arraycopy(buf, pos+1, _v, 0, l);
if (custom == null) {
return new IsoValue<byte[]>(type, _v, null);
} else if (custom instanceof CustomBinaryField) {
try {
T dec = ((CustomBinaryField<T>)custom).decodeBinaryField(buf, pos + 1, l);
return dec == null ? new IsoValue<byte[]>(type, _v, _v.length, null) :
new IsoValue<T>(type, dec, l, custom);
} catch (IndexOutOfBoundsException ex) {
throw new ParseException(String.format(
"Insufficient data for LLBIN field %d, pos %d length %d",
field, pos, l), pos);
}
} else {
T dec = custom.decodeField(HexCodec.hexEncode(_v, 0, _v.length));